﻿using BBICMS.Model.Enum;

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web;

namespace BBICMS.DTO
{
    public class MenuDTO
    {
        public MenuDTO()
        {           
            this.ChildMenus = new HashSet<MenuDTO>();
            this.MenuType = MenuType.PAGE;
        }

        public int Id { get; set; }
        [Display(Name = "菜单名称", Prompt = "菜单名称")]
        [Required(ErrorMessage = "请输入菜单名称")]
        public string Title { get; set; }      
        [Display(Name = "链接地址", Prompt = "链接地址")]
        public string Url { get; set; }

        [Display(Name = "域")]
        public string Area { get; set; }
        [Display(Name = "控制器")]
        public string Controller { get; set; }
        [Display(Name = "操作")]
        public string Action { get; set; }

        [Display(Name = "类型", Prompt = "类型")]
        public MenuType MenuType { get; set; }

        [Display(Name = "图标")]
        public string Iconfont { get; set; }

        [Display(Name = "排序", Prompt = "排序")]
        [Required(ErrorMessage = "请输入排序")]
  
        public int Importance { get; set; }

        [Display(Name = "激活", Prompt = "激活")]
        public bool Active { get; set; }
        //[Display(Name = "隐藏")]
        //public bool Hidden { get; set; }
        [Display(Name = "父级菜单")]
        public int? ParentId { get; set; } 
        public int CategoryId { get; set; }
        public virtual ICollection<MenuDTO> ChildMenus { get; set; }

        public bool CanEdit
        {
            get
            {
                return HttpContext.Current.User.IsInRole("创始人");
            }
        }

    }
}
